package com.by.controller;

import cn.hutool.core.bean.BeanUtil;
import com.by.bean.Message;
import com.by.common.bean.PageBean;
import com.by.common.bean.ResultBean;
import com.by.common.controller.BaseController;
import com.by.querypage.MessageQuery;
import com.by.service.MessageService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@RestController
@RequestMapping("/api")
@Api(tags = "系统消息")
public class MessageController extends BaseController {
    @Autowired
    MessageService messageService;

    @ApiOperation("消息通知")
    @PostMapping("/message/query")
    public ResultBean<PageBean<List<Message>>> query(@RequestBody MessageQuery query){
        PageBean pageBean = messageService.queryByMap(BeanUtil.beanToMap(query));
        return success("查询成功",pageBean);
    }

}
